package com.hc.util;

import com.hc.model.QcEquipmentRecordModel;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.*;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author LiuZhiHao
 * @date 2019/9/26 9:59
 * 描述: 适配各种类型数据
 **/
public class QcEqRdExcelUtil {


    public static void exportExcel(HSSFWorkbook workbook, String s, List<QcEquipmentRecordModel> qcEquipmentRecordModels1) {
        HSSFCellStyle cellStyle = ExcelUtils.createErrorStyle(workbook, (short) 10, false, true, (short) 0);
        switch (s) {
            case "1":
                HSSFSheet sheet = workbook.createSheet("冰箱");
                //设置头
                String[] headers = {"设备名称", "运行状态", "冷藏温度","冷冻温度", "操作者", "操作时间"};
                HSSFRow row = sheet.createRow(0);
                ExcelUtils.createCell(headers, row, workbook, sheet);
                int rowNum = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet.createRow(rowNum);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    if (StringUtils.equals(m.getRunningStatus(), "1")) {
                        rown.createCell(1).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(1);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    rown.createCell(2).setCellValue(m.getColdTemperature());
                    rown.createCell(3).setCellValue(m.getFreezingTemperature());
                    rown.createCell(4).setCellValue(m.getCreateName());
                    rown.createCell(5).setCellValue(formatDate(m.getCreateTime()));
                    rowNum++;
                }
                break;
            case "2":
                HSSFSheet sheet2 = workbook.createSheet("液氮罐");
                String[] headers2 = {"设备名称", "监控系统", "液氮罐锁", "罐体温度", "液氮罐锁备注", "罐体温度备注", "操作者", "操作时间"};
                HSSFRow row2 = sheet2.createRow(0);
                ExcelUtils.createCell(headers2, row2, workbook, sheet2);
                int rowNum2 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet2.createRow(rowNum2);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    String monitoringSystem = m.getMonitoringSystem();
                    if (StringUtils.equals(monitoringSystem, "1")) {
                        rown.createCell(1).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(1);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    String canisterLock = m.getCanisterLock();
                    if (StringUtils.equals(canisterLock, "1")) {
                        rown.createCell(2).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(2);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    String canisterTemperature = m.getCanisterTemperature();
                    if (StringUtils.equals(canisterTemperature, "1")) {
                        rown.createCell(3).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(3);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    String tankLockInfo = m.getTankLockInfo();
                    if (StringUtils.isNotEmpty(tankLockInfo)) {
                        rown.createCell(4).setCellValue(tankLockInfo);
                    }
                    String tankTemperatureInfo = m.getTankTemperatureInfo();
                    if (StringUtils.isNotEmpty(tankTemperatureInfo)) {
                        rown.createCell(5).setCellValue(tankTemperatureInfo);
                    }
                    rown.createCell(6).setCellValue(m.getCreateName());
                    rown.createCell(7).setCellValue(formatDate(m.getCreateTime()));
                    rowNum2++;
                }
                break;
            case "3":
                HSSFSheet sheet3 = workbook.createSheet("气瓶室");
                String[] headers3 = {"设备名称", "N2", "CO2", "混合气", "是否更换气体", "管道压力", "输入压力", "管道压力备注", "操作者", "操作时间"};
                HSSFRow row3 = sheet3.createRow(0);
                ExcelUtils.createCell(headers3, row3, workbook, sheet3);
                int rowNum3 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet3.createRow(rowNum3);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    rown.createCell(1).setCellValue(gasChoose(m.getNitrogen()));
                    rown.createCell(2).setCellValue(gasChoose(m.getCoz()));
                    rown.createCell(3).setCellValue(gasChoose(m.getCombinationGas()));
                    String replaceGas = m.getReplaceGas();
                    if (StringUtils.equals(replaceGas, "1")) {
                        rown.createCell(4).setCellValue("是");
                    } else {
                        rown.createCell(4).setCellValue("否");
                    }
                    String pipelinePressure = m.getPipelinePressure();
                    if (StringUtils.equals(pipelinePressure, "1")) {
                        rown.createCell(5).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(5);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    String inputPressure = m.getInputPressure();
                    if (StringUtils.equals(inputPressure, "1")) {
                        rown.createCell(6).setCellValue("正常");
                    } else if (StringUtils.equals(inputPressure, "2")) {
                        rown.createCell(6).setCellValue("偏低");
                    } else {
                        rown.createCell(6).setCellValue("无");
                    }
                    String pipelinePressureInfo = m.getPipelinePressureInfo();
                    if (StringUtils.isNotEmpty(pipelinePressureInfo)) {
                        rown.createCell(7).setCellValue(pipelinePressureInfo);
                    }
                    rown.createCell(8).setCellValue(m.getCreateName());
                    rown.createCell(9).setCellValue(formatDate(m.getCreateTime()));
                    rowNum3++;
                }
                break;
            case "4":
                HSSFSheet sheet4 = workbook.createSheet("培养箱");
                String[] headers4 = {"设备名称", "运行状态", "操作者", "操作时间"};
                HSSFRow row4 = sheet4.createRow(0);
                ExcelUtils.createCell(headers4, row4, workbook, sheet4);
                int rowNum4 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet4.createRow(rowNum4);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    String runningStatus = m.getRunningStatus();
                    switch (runningStatus) {
                        case "1":
                            rown.createCell(1).setCellValue("正常");
                            break;
                        case "3":
                            HSSFCell hssfCell = rown.createCell(1);
                            hssfCell.setCellValue("温度异常");
                            hssfCell.setCellStyle(cellStyle);
                            break;
                        case "4":
                            HSSFCell hssfCell2 = rown.createCell(1);
                            hssfCell2.setCellValue("气体异常");
                            hssfCell2.setCellStyle(cellStyle);
                            break;
                        default:
                            break;
                    }
                    rown.createCell(2).setCellValue(m.getCreateName());
                    rown.createCell(3).setCellValue(formatDate(m.getCreateTime()));
                    rowNum4++;
                }
                break;
            case "5":
                HSSFSheet sheet5 = workbook.createSheet("操作台");
                String[] headers5 = {"设备名称", "运行状态", "操作者", "操作时间"};
                HSSFRow row5 = sheet5.createRow(0);
                ExcelUtils.createCell(headers5, row5, workbook, sheet5);
                int rowNum5 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet5.createRow(rowNum5);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    String runningStatus = m.getRunningStatus();
                    switch (runningStatus) {
                        case "1":
                            rown.createCell(1).setCellValue("正常");
                            break;
                        case "3":
                            HSSFCell hssfCell = rown.createCell(1);
                            hssfCell.setCellValue("温度异常");
                            hssfCell.setCellStyle(cellStyle);
                            break;
                        case "5":
                            HSSFCell hssfCell2 = rown.createCell(1);
                            hssfCell2.setCellValue("风机异常");
                            hssfCell2.setCellStyle(cellStyle);
                            break;
                        default:
                            break;
                    }
                    rown.createCell(2).setCellValue(m.getCreateName());
                    rown.createCell(3).setCellValue(formatDate(m.getCreateTime()));
                    rowNum5++;
                }
                break;
            case "6":
                HSSFSheet sheet6 = workbook.createSheet("倒置显微镜");
                String[] headers6 = {"设备名称", "运行状态", "备注", "操作者", "操作时间"};
                HSSFRow row6 = sheet6.createRow(0);
                ExcelUtils.createCell(headers6, row6, workbook, sheet6);
                int rowNum6 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet6.createRow(rowNum6);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    String runningStatus = m.getRunningStatus();
                    switch (runningStatus) {
                        case "1":
                            rown.createCell(1).setCellValue("正常");
                            break;
                        case "6":
                            HSSFCell hssfCell = rown.createCell(1);
                            hssfCell.setCellValue("光源异常");
                            hssfCell.setCellStyle(cellStyle);
                            break;
                        case "7":
                            HSSFCell hssfCell2 = rown.createCell(1);
                            hssfCell2.setCellValue("其他异常");
                            hssfCell2.setCellStyle(cellStyle);
                            break;
                        case "3":
                            HSSFCell hssfCell3= rown.createCell(1);
                            hssfCell3.setCellValue("温度异常");
                            hssfCell3.setCellStyle(cellStyle);
                        default:
                            break;
                    }
                    String remark = m.getRemark();
                    if (StringUtils.isNotEmpty(remark)) {
                        rown.createCell(2).setCellValue(remark);
                    }
                    rown.createCell(3).setCellValue(m.getCreateName());
                    rown.createCell(4).setCellValue(formatDate(m.getCreateTime()));
                    rowNum6++;
                }
                break;
            case "7":
                HSSFSheet sheet7 = workbook.createSheet("培养室温湿度");
                String[] headers7 = {"设备名称", "运行状态", "备注", "操作者", "操作时间"};
                HSSFRow row7 = sheet7.createRow(0);
                ExcelUtils.createCell(headers7, row7, workbook, sheet7);
                int rowNum7 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet7.createRow(rowNum7);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    String runningStatus = m.getRunningStatus();
                    switch (runningStatus) {
                        case "1":
                            rown.createCell(1).setCellValue("正常");
                            break;
                        case "3":
                            HSSFCell hssfCell = rown.createCell(1);
                            hssfCell.setCellValue("温度异常");
                            hssfCell.setCellStyle(cellStyle);
                            break;
                        case "8":
                            HSSFCell hssfCell2 = rown.createCell(1);
                            hssfCell2.setCellValue("湿度异常");
                            hssfCell2.setCellStyle(cellStyle);
                            break;
                        default:
                            break;
                    }
                    String remark = m.getRemark();
                    if (StringUtils.isNotEmpty(remark)) {
                        rown.createCell(2).setCellValue(remark);
                    }
                    rown.createCell(3).setCellValue(m.getCreateName());
                    rown.createCell(4).setCellValue(formatDate(m.getCreateTime()));
                    rowNum7++;
                }
                break;
            case "8":
                HSSFSheet sheet8 = workbook.createSheet("其他仪器设备");
                String[] headers8 = {"设备名称", "运行状态", "备注", "操作者", "操作时间"};
                HSSFRow row8 = sheet8.createRow(0);
                ExcelUtils.createCell(headers8, row8, workbook, sheet8);
                int rowNum8 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet8.createRow(rowNum8);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    String runningStatus = m.getRunningStatus();
                    if (StringUtils.equals(runningStatus, "1")) {
                        rown.createCell(1).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(1);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    String remark = m.getRemark();
                    if (StringUtils.isNotEmpty(remark)) {
                        rown.createCell(2).setCellValue(remark);
                    }
                    rown.createCell(3).setCellValue(m.getCreateName());
                    rown.createCell(4).setCellValue(formatDate(m.getCreateTime()));
                    rowNum8++;
                }
                break;
            case "9":
                Map<String, List<QcEquipmentRecordModel>> collect = qcEquipmentRecordModels1.stream().collect(Collectors.groupingBy(QcEquipmentRecordModel::getWorkbenchOperationType));
                Set<String> strings = collect.keySet();
                strings.forEach(h -> {
                    List<QcEquipmentRecordModel> qcEquipmentRecordModels = collect.get(h);
                    switch (h) {
                        case "1":
                            HSSFSheet sheet9 = workbook.createSheet("ICSI工作台");
                            String[] headers9 = {"设备名称", "油量", "操作臂行程", "温板温度", "添加矿物油", "光源", "操作者", "操作时间", "操作模式"};
                            HSSFRow row9 = sheet9.createRow(0);
                            ExcelUtils.createCell(headers9, row9, workbook, sheet9);
                            int rowNum9 = 1;
                            for (QcEquipmentRecordModel m : qcEquipmentRecordModels) {
                                HSSFRow rown = sheet9.createRow(rowNum9);
                                rown.createCell(0).setCellValue(m.getDeviceName());
                                String oilMass = m.getOilMass();
                                if (StringUtils.equals(oilMass, "1")) {
                                    rown.createCell(1).setCellValue("高");
                                } else if (StringUtils.equals(oilMass, "2")) {
                                    rown.createCell(1).setCellValue("中");
                                } else {
                                    rown.createCell(1).setCellValue("低");
                                }
                                String motionArm = m.getMotionArm();
                                if (StringUtils.equals(motionArm, "1")) {
                                    rown.createCell(2).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(2);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String wenBoard = m.getWenBoard();
                                if (StringUtils.equals(wenBoard, "1")) {
                                    rown.createCell(3).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(3);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String mineralOil = m.getMineralOil();
                                if (StringUtils.equals(mineralOil, "1")) {
                                    rown.createCell(4).setCellValue("是");
                                } else {
                                    rown.createCell(4).setCellValue("否");
                                }
                                String lightSource = m.getLightSource();
                                if (StringUtils.equals(lightSource, "1")) {
                                    rown.createCell(5).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(5);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                rown.createCell(6).setCellValue(m.getCreateName());
                                rown.createCell(7).setCellValue(formatDate(m.getCreateTime()));
                                String workbenchOperationPattern = m.getWorkbenchOperationPattern();
                                if (StringUtils.equals(workbenchOperationPattern, "1")) {
                                    rown.createCell(8).setCellValue("操作前");
                                } else {
                                    rown.createCell(8).setCellValue("操作后");
                                }
                                rowNum9++;
                            }
                            break;
                        case "2":
                            HSSFSheet sheet10 = workbook.createSheet("AS工作台");
                            String[] headers10 = {"设备名称", "温板温度", "激光能量", "光源", "激光焦点位置", "操作者", "操作时间", "操作模式"};
                            HSSFRow row10 = sheet10.createRow(0);
                            ExcelUtils.createCell(headers10, row10, workbook, sheet10);
                            int rowNum10 = 1;
                            for (QcEquipmentRecordModel m : qcEquipmentRecordModels) {
                                HSSFRow rown = sheet10.createRow(rowNum10);
                                rown.createCell(0).setCellValue(m.getDeviceName());
                                String wenBoard = m.getWenBoard();
                                if (StringUtils.equals(wenBoard, "1")) {
                                    rown.createCell(1).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(1);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String laserLightSource = m.getLaserLightSource();
                                if (StringUtils.equals(laserLightSource, "1")) {
                                    rown.createCell(2).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(2);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String lightSource = m.getLightSource();
                                if (StringUtils.equals(lightSource, "1")) {
                                    rown.createCell(3).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(3);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String laserFocusPosition = m.getLaserFocusPosition();
                                if (StringUtils.equals(laserFocusPosition, "1")) {
                                    rown.createCell(4).setCellValue("正常");
                                } else if (StringUtils.equals(laserFocusPosition, "2")) {
                                    rown.createCell(4).setCellValue("轻微偏差");
                                } else {
                                    rown.createCell(4).setCellValue("偏差较大");
                                }
                                rown.createCell(5).setCellValue(m.getCreateName());
                                rown.createCell(6).setCellValue(formatDate(m.getCreateTime()));
                                String workbenchOperationPattern = m.getWorkbenchOperationPattern();
                                if (StringUtils.equals(workbenchOperationPattern, "1")) {
                                    rown.createCell(7).setCellValue("操作前");
                                } else {
                                    rown.createCell(7).setCellValue("操作后");
                                }
                                rowNum10++;
                            }
                            break;
                        case "3":
                            HSSFSheet sheet11 = workbook.createSheet("胚胎活检工作台");
                            String[] headers11 = {"设备名称", "油量", "操作臂行程", "温板温度", "激光能量", "光源", "激光焦点位置", "操作者", "操作时间", "操作模式"};
                            HSSFRow row11 = sheet11.createRow(0);
                            ExcelUtils.createCell(headers11, row11, workbook, sheet11);
                            int rowNum11 = 1;
                            for (QcEquipmentRecordModel m : qcEquipmentRecordModels) {
                                HSSFRow rown = sheet11.createRow(rowNum11);
                                rown.createCell(0).setCellValue(m.getDeviceName());
                                String oilMass = m.getOilMass();
                                if (StringUtils.equals(oilMass, "1")) {
                                    rown.createCell(1).setCellValue("高");
                                } else if (StringUtils.equals(oilMass, "2")) {
                                    rown.createCell(1).setCellValue("中");
                                } else {
                                    rown.createCell(1).setCellValue("低");
                                }
                                String motionArm = m.getMotionArm();
                                if (StringUtils.equals(motionArm, "1")) {
                                    rown.createCell(2).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(2);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String wenBoard = m.getWenBoard();
                                if (StringUtils.equals(wenBoard, "1")) {
                                    rown.createCell(3).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(3);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String laserLightSource = m.getLaserLightSource();
                                if (StringUtils.equals(laserLightSource, "1")) {
                                    rown.createCell(4).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(4);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String lightSource = m.getLightSource();
                                if (StringUtils.equals(lightSource, "1")) {
                                    rown.createCell(5).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(5);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String laserFocusPosition = m.getLaserFocusPosition();

                                if (StringUtils.equals(laserFocusPosition, "1")) {
                                    rown.createCell(6).setCellValue("正常");
                                } else if (StringUtils.equals(laserFocusPosition, "2")) {
                                    rown.createCell(6).setCellValue("轻微偏差");
                                } else {
                                    rown.createCell(6).setCellValue("偏差较大");
                                }
                                rown.createCell(7).setCellValue(m.getCreateName());
                                rown.createCell(8).setCellValue(formatDate(m.getCreateTime()));
                                String workbenchOperationPattern = m.getWorkbenchOperationPattern();
                                if (StringUtils.equals(workbenchOperationPattern, "1")) {
                                    rown.createCell(9).setCellValue("操作前");
                                } else {
                                    rown.createCell(9).setCellValue("操作后");
                                }
                                rowNum11++;
                            }
                            break;
                        case "4":
                            HSSFSheet sheet12 = workbook.createSheet("胚胎观察工作台");
                            String[] headers12 = {"设备名称", "温板温度", "光源", "操作者", "操作时间", "操作模式"};
                            HSSFRow row12 = sheet12.createRow(0);
                            ExcelUtils.createCell(headers12, row12, workbook, sheet12);
                            int rowNum12 = 1;
                            for (QcEquipmentRecordModel m : qcEquipmentRecordModels) {
                                HSSFRow rown = sheet12.createRow(rowNum12);
                                rown.createCell(0).setCellValue(m.getDeviceName());
                                String wenBoard = m.getWenBoard();
                                if (StringUtils.equals(wenBoard, "1")) {
                                    rown.createCell(1).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(1);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                String lightSource = m.getLightSource();
                                if (StringUtils.equals(lightSource, "1")) {
                                    rown.createCell(2).setCellValue("正常");
                                } else {
                                    HSSFCell hssfCell = rown.createCell(2);
                                    hssfCell.setCellValue("异常");
                                    hssfCell.setCellStyle(cellStyle);
                                }
                                rown.createCell(3).setCellValue(m.getCreateName());
                                rown.createCell(4).setCellValue(formatDate(m.getCreateTime()));
                                String workbenchOperationPattern = m.getWorkbenchOperationPattern();
                                if (StringUtils.equals(workbenchOperationPattern, "1")) {
                                    rown.createCell(5).setCellValue("操作前");
                                } else {
                                    rown.createCell(5).setCellValue("操作后");
                                }
                                rowNum12++;
                            }
                            break;
                        default:
                            break;
                    }
                });
                break;
            case "11":
                HSSFSheet sheet13 = workbook.createSheet("离心机");
                //设置头
                String[] headers13 = {"设备名称", "运行状态", "操作者", "操作时间"};
                HSSFRow row13 = sheet13.createRow(0);
                ExcelUtils.createCell(headers13, row13, workbook, sheet13);
                int rowNum13 = 1;
                for (QcEquipmentRecordModel m : qcEquipmentRecordModels1) {
                    HSSFRow rown = sheet13.createRow(rowNum13);
                    rown.createCell(0).setCellValue(m.getDeviceName());
                    if (StringUtils.equals(m.getRunningStatus(), "1")) {
                        rown.createCell(1).setCellValue("正常");
                    } else {
                        HSSFCell hssfCell = rown.createCell(1);
                        hssfCell.setCellValue("异常");
                        hssfCell.setCellStyle(cellStyle);
                    }
                    rown.createCell(2).setCellValue(m.getCreateName());
                    rown.createCell(3).setCellValue(formatDate(m.getCreateTime()));
                    rowNum13++;
                }
                break;
            default:
                break;
        }
    }

    public static String gasChoose(String gas) {
        switch (gas) {
            case "1":
                return "有";
            case "2":
                return "无";
            case "3":
                return "停用";
            default:
                break;
        }
        return null;
    }

    public static String formatDate(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(date);

    }

}
